# 登录到私服
if ! docker login -u admin -p 2giqYy98lB maven.cqtancheng.com; then
    echo "登录到私服失败"
    exit 1
fi

# 构建并推送多平台镜像到私服
if ! docker buildx build --platform linux/amd64,linux/arm64 -f docker-base --no-cache -t maven.cqtancheng.com/jlcon/nas-base:latest --push .; then
    echo "构建并推送镜像到私服失败"
    exit 1
fi

# 清理本地悬空镜像
if ! docker image prune -f; then
    echo "清理本地悬空镜像失败"
    exit 1
fi